package com.example.s07configuration;

import lombok.Data;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
import org.testng.annotations.Test;


//
//@Data
//@Component
//@PropertySource("classpath:supplier.properties")
////如果只写@ConfigurationProperties(prefix = "supplier")，表示在全局配置文件（application.properties）中查找以“supplier”开头的属性进行注入
////如果Supplier类的属性值不是定义在全局配置文件中的，就需要再加@PropertySource("classpath:supplier.properties")表示在哪个配置文件中查找属性值
//@ConfigurationProperties(prefix = "supplier")
//public class Supplier {
//    private String scode;
//    private String  spassword;
//    private  String sname;
//
//}
@Data
@Component
@PropertySource("classpath:supplier.properties")
public class Supplier {
    @Value("${supplier.scode}")
    private String scode;

    @Value("${supplier.spassword}")
    private String  spassword;

    @Value("${supplier.sname}")
    private  String sname;
    @Value("${imagepath}")
    String imagePath;
    @Test
    void getFilePath2(){
        System.out.println(imagePath);
    }

}